export function formatTimeSince(unixTimestamp) {
    const currentTime = new Date().getTime(); // 获取当前时间的毫秒数
    const timeDifference = currentTime - unixTimestamp; // 转换为毫秒
    // console.log(currentTime);
    // console.log(unixTimestamp);
    // console.log(timeDifference);
    
    if (timeDifference < 60000) {
        return '刚刚'; // 一分钟内
    } else if (timeDifference < 3600000) {
        const minutes = Math.floor(timeDifference / 60000);
        return `${minutes}分钟前`; // 一小时内
    } else if (timeDifference < 86400000) {
        const hours = Math.floor(timeDifference / 3600000);
        return `${hours}小时前`; // 一天内
    } else if (timeDifference < 2592000000) {
        const days = Math.floor(timeDifference / 86400000);
        return `${days}天前`; // 一个月内
    } else if (timeDifference < 7776000000) {
        const months = Math.floor(timeDifference / 2592000000);
        return `${months}个月前`; // 三个月内
    } else {
        return null; // 超过三个月
    }
}
